#include <stdint.h>
#include <stdlib.h>
#include <RS_fec.h>

typedef struct RsFecWrapperS RsFecWrapperT;
struct RsFecWrapperS
{
    RS_fec *rf;
    
};

extern "C"
{

RsFecWrapperT *RFWCreate(int dataNum, int fecNum, int dataLen)
{
    RsFecWrapperT *rfw = NULL;
    rfw = (RsFecWrapperT *)malloc(sizeof(*rfw));
    rfw->rf = new RS_fec;
    rfw->rf->fec_init(dataNum, fecNum, dataLen);
    return rfw;
}

int RFWDecode(RsFecWrapperT *rfw, uint8_t **pData, uint8_t **pFec, int *lostMap)
{
    int ret;
    
    ret = rfw->rf->fec_decode(pData, pFec, lostMap);

    return ret;
}

int RFWEncode(RsFecWrapperT *rfw, uint8_t **pData, uint8_t **pFec)
{
    int ret;
    
    ret = rfw->rf->fec_encode(pData, pFec);

    return ret;
}

}
